//
//  CHBottomLineView.swift
//  CHSimpleUI
//
//  Created by cyptt on 2024/6/4.
//

//底部line view ，如果需要自定义请使用uiview 的extensionaddBottomBorder
import UIKit

open class CHBottomBorderView: UIView {
    
    var bottomBorderColor: UIColor =  UIColor.init(red: 231/255.0, green: 231/255.0, blue: 231/255.0, alpha: 1)
    
    var bottomBorderWidth: CGFloat = 0.5
    public override func draw(_ rect: CGRect) {
        super.draw(rect)
        // 设置底部线的颜色和宽度
        bottomBorderColor.setStroke()
        
        
        // 计算底部线的路径
        let bottomLinePath = UIBezierPath()
        bottomLinePath.move(to: CGPoint(x: 0, y: rect.height - bottomBorderWidth / 2))
        bottomLinePath.addLine(to: CGPoint(x: rect.width, y: rect.height - bottomBorderWidth / 2))
        
        // 绘制底部线
        bottomLinePath.stroke()
    }
}
